home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tiger Disk 44
/
Tiger_Disk_044_1997-11_Tiger-Crew-Disk_de_Side_C.d64
/
dir repair
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
11KB
|
441 lines
100 rem !-----------------------------!
110 rem ! arvee's directory repairman !
120 rem ! !
130 rem ! c-1987 whitaker labs !
140 rem ! !
150 rem ! brought to you by scormus !
160 rem !-----------------------------!
170 :
180 rem protect geos from basic
190 ifpeek(56)>126thenpoke56,126:clr
200 :
210 rem dims flgs vars constnts strings
220 rem dimensions
230 dim bf(23):rem blks free computed
240 dim bd(20):rem dir blks followed
250 dim m$(11):rem msgs
260 dim f$(7) :rem file names
270 dim bm(2) :rem bam temp 0-7/8-f/10+
280 :
290 rem flags
300 pe=0:rem prnt err chn 1=prnt
310 is=0:rem illegal sectr
320 bd=0:rem bad directory
330 bb=0:rem bad block
340 bp=0:rem bad pointer
350 nf=0:rem dir not fixed
360 bt=0:rem off tr 18
370 :
380 rem variables
390 x=0:y=0:t=0:rem loop vars
400 tr=18:se=0:rem default tr/se
410 tv=18:sv=0:rem tr/se pntr val
420 al=55537 :rem color poke pseudo base
430 m =0:d=0 :rem message #/# lines down
440 cf=0:bl=0:rem comp/actual blks free
450 nd=0:e=0 :rem new dos vers
460 ct=0 :rem # of misalloc blks
470 p =0 :rem buffer pointer
480 :
490 rem strings
500 a$="":b$="":c$="":d$="":rem tmp str
510 wp$="":rem write protect
520 nl$=chr$(0):rem null
530 l$="[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
540 l2$=" [192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
550 r1$=""
560 r2$="[156]"
570 :
580 rem geos specific constants
590 da=33938:rem disk turbo flg drive a
600 db=33939:rem disk turbo flg drive b
610 v2=49893:rem vers 1.2 setup sys
620 v3=49708:rem vers 1.2/3 restart
630 vl=49158:rem geos boot & vers # loc
640 forx=0to8:rem check for geostoboot
650 gb$=gb$+chr$(peek(vl+x)):rem string
660 next:rem for poss desktop reentry
670 ve=peek(vl+x):rem geos vers #
680 :
690 rem messages
700 m$(0)="[154]<< [208]ress [203]ey [198]or [205]enu[160]>>"
710 m$(1)="[154]<< [208]ress [203]ey [212]o [194]oot >>"
720 m$(2)="[150]<< [215][193][210][206][201][206][199][160]!!![160][160][205][201][211][193][204][204][207][195][193][212][197][196] [194][204][207][195][203][211] >>"
730 m$(3)="<< [207]peration [193]borted .. [200]it a [203]ey >>"
740 m$(4)="<< [215][193][210][206][201][206][199] !!! [194][193][196][160][196][201][210][197][195][212][207][210][217] >>"
750 m$(5)="[150]<< [215][193][210][206][201][206][199] !!! [194][193][196][160][197][206][196][160][208][212][210] >>"
760 m$(6)="<< [207]peration [198]ailed .. [210]etry >>"
770 m$(7)="[154]<< [208]ress [203]ey for [205]enu >>
780 m$(8)[178]"cont<< (NULL)(NULL) (NULL)tatus lenhanged >>
790 m$(9)="<< [201][204][204][197][199][193][204] [207][198][198] [208][193][199][197] [196][201][210][197][195][212][207][210][217] [194][204][207][195][203] >>"
800 m$(10)="[150]<< [196][197][211][203][212][207][208][160][194][207][210][196][197][210] [200][193][211][160][194][197][197][206][160][197][210][193][211][197][196] >>"
810 m$(11)="<< [215][193][210][206][201][206][199] !!! [196][201][210][197][195][212][207][210][217][160][207][198][198][160][212][210][203][160]18 >>"
820 :
830 rem title screen & get routine #
840 poke53280,11:rem grey border
850 poke53281, 0:rem black screen
860 :
870 print"[147][146] [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]
880 [153]" (NULL) clrstr$right$(NULL)vallen(NULL)(NULL)(NULL)(NULL)close(NULL)val(NULL)atnright$(NULL)(NULL)atn(NULL) (NULL)
890 print" [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]
900 [153]" poke(sys(NULL)poke)contrite (NULL)rotect str$isk
910 print" [151]([158][213][151])[154]n [215]rite [208]rotect
920 [153]" poke(sysstr$poke)contesk peekorder right$nfo
930 print" [151]([158][193][151])[154]nalyze [212]rack 18
940 [153]" poke(sys(NULL)poke)contepair str$irectory
950 print" [193]llocate track 18
960 [153]" ascollow dir chain
970 print" [198]ix last pointer
980 [153]" ascree unused blks
990 print" [151]([158][194][151])[154]asic
1000 [153]" poke(syschr$poke)contval(NULL)(NULL)
1010 :
1020 poke198,0:wait198,1:geta$
1030 ifa$="d"then 3750:rem geos info
1040 ifa$="a"then 2040:rem analyze
1050 ifa$="r"then 2910:rem repair
1060 ifa$="w"then 3500:rem write prot
1070 ifa$="u"then 3510:rem un wp
1080 ifa$="b"then print"[145][145][145][154]":end
1090 ifa$="g"then 1110:rem go geos
1100 goto1020
1110 rem geos desktop return
1120 if gb$<>"geos boot" then 1170
1130 poke da,0:poke db,0:rem turbo off
1140 if ve=18 then sys v2:sys v3
1150 if ve=19 then sys v3
1160 rem boot geos
1170 print"[147] [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
1180 print " [221] [156][201][206][211][197][210][212][160][199][197][207][211][160][194][207][207][212][160][196][201][211][203] [221]"
1190 print " [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189][154]"
1200 m=1:d=15:gosub1260
1210 print"[147]load"chr$(34)"geos"chr$(34)",8,1"
1220 print "run
1230 [151]198,3:[151]631,19:[151]632,13:[151]633,13:[144]
1240 :
1250 [143] flash message # m down d
1260 [153]"";:[129]x[178]0[164]d:[153]"";:[130]
1270 [151]198,0
1280 [129]x[178]1[164]2
1290 [153]"waiton"
1300 [139]x[178]2[167][153]"";
1310 [153] m$(m);
1320 [129]y[178]1[164]100:[161]a$
1330 [139] a$[178]""[167] [130]:[130]:[137]1280
1340 [139] a$[178]"_"[167] [138]
1350 [153]"wait";:[142]
1360 :
1370 [143] check dev pres
1380 [160]15:[159]15,8,15:[160]15
1390 [139] st [178] 0 [167] [142]
1400 [153]" str$evice (NULL)ot (NULL)resent"
1410 m[178]3:d[178]23:[141]1260:[138]
1420 :
1430 [143] initialize
1440 [141]1660:[159]15,8,15,"i0:":[142]
1450 :
1460 [143] check error channel
1470 [143] close all/open/read/print
1480 [141]1660:[159]15,8,15
1490 [143] read/print
1500 pe[178]1:[143] prnt flg
1510 [143] read only
1520 [132]15,en$,em$,et$,es$
1530 [139]en$[179][177]"00"[167][153]:[153]"";
1540 [139] pe[178]1 [167][153]en$","em$","et$","es$:pe[178]0
1550 [139] en$[178]"00"[167] [142]
1560 [137]1410
1570 :
1580 [143] init for io
1590 [141]1380:[143] chk device present
1600 [141]1440:[143] initialize drive
1610 [141]1520:[143] read err
1620 [141]1690:[143] alloc disk buffer
1630 [142]
1640 :
1650 [143] done with io
1660 [129]x[178]1[164]15:[160]x:[130]:[142]
1670 :
1680 [143] allocate a disk buffer
1690 [159]2,8,2,"#":[142]
1700 :
1710 [143] read buffer
1720 [152]15,"u1";2;0;tr;se:[142]
1730 :
1740 [143] write buffer
1750 [152]15,"u2";2;0;tr;se:[142]
1760 :
1770 [143] buffer pointer
1780 [152]15,"b-p";2;p:[142]
1790 :
1800 [143] check if sector is legal
1810 is[178]0:[143] sector is ok
1820 [139] se[179]0 [167] 1880
1830 [139] tr[179]0 [167] 1880
1840 [139] tr[179]18 [167] [139] se[179]21 [167] [142]
1850 [139] tr[179]25 [167] [139] se[179]19 [167] [142]
1860 [139] tr[179]31 [167] [139] se[179]18 [167] [142]
1870 [139] tr[179]36 [167] [139] se[179]17 [167] [142]
1880 is[178]1:[143] sector not ok
1890 [142]
1900 :
1910 [143] job queue
1920 [152]15,"m-w"[199](8)[199](0)[199](2)[199](tr)[199](se)
1930 [152]15,"m-w"[199](1)[199](0)[199](1)[199](job)
1940 [129]t[178]0[164]500
1950 [151]53280,([194](53280)[170]1)[175]15
1960 [152]15,"m-r"[199](1)[199](0)
1970 [161]#15,e$:e[178][198](e$[170]nl$)
1980 [139] e[177]127 [167] [130] t
1990 [151]53280,11:
2000 [139] e[178]1 [167] [142]
2010 [160]15:m[178]6:d[178]23:[141]1260:[138]
2020 :
2030 [143] display track 18 bam
2040 [153]"load ortantantantantantantantantantantantantantantantantantantantantantantan^"
2050 [153]" (NULL) clratn(NULL)atn(NULL)(NULL)(NULL)val str$right$(NULL)vallen(NULL)(NULL)(NULL)(NULL)closepeekatn(NULL) (NULL)"
2060 [153]" /tantantantantantantantantantantantantantantantantantantantantantantanexpcont"
2070 [141]1590:[143] init io
2080 bd[178]0:bp[178]0:bb[178]0:bt[178]0:[143] set flags
2090 cf[178]0:[143] computed free blks
2100 tr[178]18:se[178]0:[143] defaults
2110 [143] input bam info
2120 [153]"(NULL)eading peekatn(NULL) ........ ";
2130 [141]1720:[143] u1
2140 [141]1500:[143] read/print
2150 p[178]2:[141]1780:[143] b-p
2160 [161]#2,a$:odv[178][198](a$[170]nl$)
2170 wp$[178]"(NULL)(NULL)":[139] odv[178]65 [167] wp$[178]"(NULL)ascasc"
2180 p[178]72:[141]1780:[143] b-p
2190 [161]#2,a$,b$,c$,d$
2200 [141]1660:[143] done io
2210 bl[178][198](a$[170]nl$) :[143] free blks
2220 bm(0)[178][198](b$[170]nl$) :[143] bam 0- 7
2230 bm(1)[178][198](c$[170]nl$) :[143] bam 8-15
2240 bm(2)[178][198](d$[170]nl$) :[143] bam 16-18
2250 [143] compute/disp blks free
2260 [129]x[178]0[164]2:[129]y[178]0[164]7
2270 bf( (8[172]x)[170]y )[178](bm(x) [175] 2[174]y)[173]2[174]y
2280 [130]y
2290 [130]x
2300 [153]"onononon "l$l$
2310 [153]"cont (NULL)rack 18 peekatn(NULL) peeklocks lenomputed"
2320 [153]" 0....5....0....5..8 ascree ascree"
2330 [153]" ";
2340 [129]x[178]0[164]18:
2350 [139] bf(x) [178] 0 [167] [153] "*";:[130]:[137]2380
2360 cf[178]cf[170]1
2370 [153]"-";:[130]
2380 [153]" ";:[139]bl[179]10[167][153]" ";
2390 [153]bl;
2400 [153]"cmd ";
2410 [139]cf[179]10[167][153]" ";
2420 [153]cf"cmd "
2430 [139] cf[178]bl [167] 2450
2440 bd[178]1:[153]"onononon "l$""l$""
2450 [153]" "l$;:[139]bd[178]1[167][153]"";:
2460 [153]l$
2470 tv[178]18:sv[178]0 :[143] 1st blk
2480 [141]1590:[143] init io
2490 [153]"cont (NULL)(NULL) (NULL)val (NULL)ointer
2500 printl2$
2510 se=sv:tr=tv:ifnf=1then2710
2520 if tv=0 then 2710
2530 rem chain next
2540 nf=0
2550 gosub1720:rem u1
2560 gosub1520:rem read err
2570 p=0:gosub1780:rem b-p
2580 get#2,tr$,se$
2590 tv=asc(tr$+nl$)
2600 sv=asc(se$+nl$)
2610 gosub1810:nf=is:rem chk legal sector
2620 bd(se)=1:print"[154]";
2630 ifbf(se)<>0thenprint"";:bd=1:bb=1:pokeal+se,2
2640 if tv>0 or sv=255 then 2660
2650 print""r1$"_[194][193][196] [208][212][210][145]":bp=1:bb=0
2660 iftr<>18theniftr<>0thenbt=1:print" "l$"[157][157] ":goto2680
2670 ifbbthenprintr1$"_[193][204][204][207][195][193][212][197][145]":bb=0
2680 printtr;se,tv;sv
2690 if tv=0 then printl2$
2700 goto2510
2710 gosub1660:rem done io
2720 rem display misalloc blks
2730 forx=0to18:if bd(x)=1then 2810
2740 if bf(x)>0 then 2810
2750 ct=ct+1:ifct>14then2800
2760 print""r2$"[213][206][213][211][197][196][160][211][197][195][212][207][210][211]
2770 [153]r2$"atn(NULL)valcloseatn(NULL)(NULL)(NULL)lenatn(NULL)valstr$onon
2780 fory=0toct:print:next
2790 printr2$"[211]ector " x"[145]"
2800 poke al+x,2
2810 nextx
2820 print"[151][215][208]"wp$
2830 rem which msg
2840 m=0:if bd=1 then m=4:rem bad dir
2850 if ct>0 then m=2:rem misaloc blks
2860 if bp=1 then m=5:rem bad end ptr
2870 if bt=1 then m=11:rem dir off trk
2880 d=23:gosub1260:run
2890 :
2900 rem fix dir
2910 print"[147] [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]
2920 [153]" (NULL) clrasc(NULL)(NULL)(NULL)(NULL)(NULL)right$(NULL)chr$closestr$right$(NULL)vallen(NULL)(NULL)(NULL)(NULL) (NULL)
2930 print" [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189][154]
2940 tr[178]18:se[178]0
2950 [141]1590:[143] init io
2960 :
2970 bf(0)[178]1
2980 [141]1720:[143] u1
2990 [141]1520:[143] read err
3000 p[178]0:[141]1780:[143] b-p
3010 [161]#2,tr$,se$
3020 tv[178][198](tr$[170]nl$)
3030 sv[178][198](se$[170]nl$)
3040 [139]tv[178]18[167]bf(sv)[178]1:se[178]sv:[137]2980
3050 [139] tv[179][177]0 [167] bt[178]1:nf[178]1:[137]3380
3060 [139] sv[178]255 [167] [153]"(NULL)ast str$ir (NULL)ector (NULL)(NULL) ";:[137]3110
3070 [153] "ascixing (NULL)ast (NULL)ector . ";
3080 p[178]1:[141]1780:[143] b-p
3090 [152]2,[199](255);
3100 p[178]0:[141]1780:[141]1750:[143] b-p/u2
3110 [141]1500:[143] read/print
3120 :
3130 [143] alloc all blks tr 18
3140 tr[178]18:se[178]0:[141]1590:[143] reinit io
3150 [153]"(NULL)eading peekatn(NULL) ........ ";
3160 [141]1720:[143] u1
3170 [141]1500:[143] read/print
3180 p[178]72:[141]1780:[143] b-p
3190 [152]2,nl$;nl$;nl$;nl$;:[143] 0 bam
3200 p[178]0:[141]1780:[143] b-p
3210 [153]"(NULL)riting peekatn(NULL) ........ ";
3220 [141]1750:[143] u2
3230 [141]1500:[143] read/print
3240 [153]" ortantantantantantantantantantantantantantantantantantan^"
3250 [153]" (NULL) clr(NULL)(NULL)(NULL) 18 atn(NULL)(NULL)(NULL)lenatn(NULL)valstr$ (NULL)
3260 print" [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189][154]"
3270 :
3280 rem free unused blocks
3290 gosub1590:rem reinit io
3300 print"[196]eallocating blks .. ";
3310 forx=0to18
3320 if bf(x) then 3360
3330 print#15,"b-f";0;18;x
3340 input#15,en,em$,et,es:rem err chn
3350 if en$<>"00" then print "[197]rror in [211]ector"x:gosub1550:nf=1
3360 nextx
3370 gosub1480:rem close/open/read/print
3380 gosub1660:rem done io
3390 if nf then 3440
3400 print" [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]
3410 [153]" (NULL) clrstr$right$(NULL)vallen(NULL)(NULL)(NULL)(NULL)close(NULL)val(NULL)atnright$(NULL)valstr$ (NULL)
3420 print" [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189][154]
3430 m[178]7:d[178]21:[141]1260:[138]
3440 [153]" ortantantantantantantantantantantantantantantantantantan^
3450 print" [221] [156][210][197][208][193][201][210][211] [198][193][201][204][197][196] ! [221]
3460 [153]" /tantantantantantantantantantantantantantantantantantanexpcont
3470 m=6:d=21:m=m+bt*5:gosub1260:run
3480 :
3490 rem edit dos version
3500 ndv=66:goto3520:rem wp on
3510 ndv=65:rem write prot off
3520 print"[147] [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]
3530 [153]" (NULL) clrvalstr$right$(NULL)right$(NULL)chr$closestr$(NULL)(NULL)close(NULL)val(NULL)(NULL)right$(NULL)(NULL) (NULL)
3540 print" [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189][154]
3550 [143] ndv=new dos version 1541 => a
3560 [143] wp off=65 on=66
3570 [141]1590:[143] init io
3580 tr[178]18:se[178]0 :[143] bam track
3590 job[178]176:[141]1920:[143] seek
3600 job[178]128:[141]1920:[143] read
3610 [152]15,"m-w"[199](2)[199](4)[199](1)[199](ndv)
3620 job[178]144:[141]1920:[143] write
3630 [141]1660:[143] done io
3640 [141]1590:[141]1660:[143] init/done io
3650 m[178]8:d[178]14:[141]1260:[138]
3660 :
3670 [143] get dos write protect status
3680 [141]1590:[143] init io
3690 [152]15,"m-r"[199](1)[199](1)
3700 [161]#15,a$:wp$[178]"(NULL)(NULL)"
3710 [139] a$[178][199](65)[167] wp$[178]"(NULL)ascasc"
3720 [141]1660:[143] done io
3730 :
3740 [143] get geos format header stuff
3750 [153]"load ortantantantantantantantantantantantantantantantantantantantantantan^
3760 print" [221] [156][199][197][207]-[196][201][211][203][160][201][206][198][207][210][205][193][212][201][207][206] [221]
3770 [153]" /tantantantantantantantantantantantantantantantantantantantantantanexpcont
3780 tr=18:se=0:ct=0
3790 gosub1590:rem init io
3800 gosub1720:rem u1
3810 p=171:gosub1780:rem b-p
3820 get#2,a$,b$:rem tr/se
3830 id$="":forx=173 to 188:get#2,c$:id$=id$+c$:next:rem geosformat string
3840 get#2,d$:rem master/boot/work flg
3850 gosub1660:rem done io
3860 if left$(id$,4)="geos"then 3910
3870 print" [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]
3880 [153]" (NULL) clr(NULL)(NULL)(NULL)closeatn chr$val(NULL)(NULL)close(NULL)(NULL)(NULL)valclosestr$right$(NULL)(NULL)close(NULL)
3890 print" [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189][154]
3900 m[178]0:d[178]12:[141]1260:[138]
3910 tr[178][198](a$[170]nl$):se[178][198](b$[170]nl$)
3920 [153]" cont"id$" -- ";
3930 [139]d$[178]"b"[167][153]"syspeekoot str$isk
3940 ifd$="p"thenprint"[158][205]aster [196]isk
3950 [139]d$[178]"" [167][153]"sys(NULL)ork str$isk
3960 print" "l$l$
3970 print"[154] [196]esktop[160][194]order[160][208]g ";
3980 print"[212][210][160]="tr"[157]"," [211][197] ="se
3990 gosub1810:rem chk legal sector
4000 ifis=0then4030
4010 print" [145][145]"l$l$"":print" "l$l$
4020 d=12:m=9:gosub1260:goto4250
4030 print" "l$l$
4040 gosub1590:rem init io
4050 gosub1720:p=0:gosub1780:rem u1/b-p
4060 get#2,a$,b$
4070 tv=asc(a$+nl$):sv=asc(b$+nl$)
4080 if tv<>0 or sv<>255 then bd=1
4090 for p=2 to 226 step 32
4100 gosub1780:get#2,a$:rem b-p
4110 if asc(a$+nl$)=0 then 4150
4120 ct=ct+1
4130 get#2,a$,b$,f$(ct-1)
4140 fory=1to15:get#2,a$:f$(ct-1)=f$(ct-1)+a$:next
4150 nextp:gosub1660:rem done io
4160 print"[198]iles on [196]esktop [194]order -";
4170 if ct=0 then print " [206][207][206][197]":goto4200
4180 print ct
4190 print:forx=1toct:printx;f$(x-1):next
4200 if bd<>1 then d=ct+14:m=0:gosub1260:run
4210 print" [176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]
4220 [153] " (NULL) clrstr$val(NULL)(NULL)(NULL)(NULL)(NULL)closepeek(NULL)(NULL)str$val(NULL)closelen(NULL)(NULL)(NULL)(NULL)(NULL)(NULL) (NULL)
4230 print" [173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189][154]
4240 [139] ct[178]0 [167] 4310
4250 [153]"cont (NULL)ou have a problem too serious for"
4260 [153]"me to address. right$t might be possible to"
4270 [153]"salvage parts of your disk if you start"
4280 [153]"now. (NULL)se a chr$(NULL)(NULL)str$ sector editor and ...."
4290 [153]" chr$(NULL)(NULL)str$ (NULL)(NULL)len(NULL)close!!!onon
4300 stop
4310 print "[156] [217]ou have"ct"files on the [196]esktop"
4320 print "[156][194]order. [215]ould you like to [197][210][193][211][197] [156]it ? ";
4330 forx=1to2
4340 if x=1 then print"[219][157]";
4350 if x=2 then print"+[157]";
4360 fory=1to70:geta$
4370 if a$=""then next:next:goto4330
4380 if a$="_"then run
4390 ifa$<>"y"then run
4400 print:print"";
4410 rem geodeformat
4420 tr=18:se=0
4430 gosub1590:rem init io
4440 gosub1720:p=171:gosub1780:rem u1/b-p
4450 fori=171to191:print#2,nl$;:next
4460 gosub1750:rem u2
4470 gosub1660:rem done io
4480 gosub1480:rem close/open/read/print
4490 d=23:m=10:gosub1260:run